<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@include file="/pageRc/common/common.jsp"%>

<!DOCTYPE html>
<html lang="en" style="overflow-x: hidden">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="msapplication-tap-highlight" content="no">

<link rel="stylesheet"
	href="<%=commonPath %>/pageRc/layui/css/layui.css" media="all">
<script type="text/javascript"
	src="<%=commonPath %>/pageRc/js/jquery-1.9.1.min.js"></script> 
<script type="text/javascript"
	src="<%=commonPath %>/pageRc/common/utils.js"></script>
<script type="text/javascript"
	src="<%=commonPath %>/pageRc/common/msgTool.js"></script>
<script type="text/javascript"
	src="<%=commonPath %>/pageRc/layui/layui.js"></script>

<title>需求预期报表</title>

<script>
	$(function(){
	 
 	})
	//注意：选项卡 依赖 element 模块，否则无法进行功能性操作
	layui.use('element', function() {
		var element = layui.element();

		//…
	});
</script>
<jsp:include page="publicMethod.jsp"/>
</head>
<body class="layui-main">
<input type="hidden" value="${positionType}" id="positionType">
 <blockquote class="layui-elem-quote">
                  		需求预期报表信息列表:
                     </blockquote>
	<div class="layui-form-item ">
		<form id="createMsgForm" name="createMsgForm" class="layui-form"
			action="">
			<div class="layui-form-item">
				<div class="layui-inline">
 					<div class="layui-inline"> 
						<select name="proGroupNo" id="proGroupNo" lay-filter="proGroupSelect">
						    <c:forEach items="${groupList}" var="group" >
	                        	<option value="${group.proGroupNo}">${group.proGroupName}</option> 
 	                    	</c:forEach>
						</select>
					</div>
					<div class="layui-inline">
						<select name="proTeamNo" id="proTeamNo" >
						<c:if test="${positionType=='70'}">
								  <c:forEach items="${teanList}" var="tean">
									<option value="${tean.proTeamNo}">${tean.proTeamName}</option>
								  </c:forEach>
							</c:if>
							<c:if test="${positionType!='70'}">
								<option value="">项目组名称</option>
							<option value="">全部</option>
							   <c:forEach items="${teanList}" var="tean" >
	                        	<option value="${tean.proTeamNo}">${tean.proTeamName}</option> 
 	                    	</c:forEach>
 	                    	</c:if>
						</select>
					</div>
					
					<div class="layui-inline">
							- 
					</div>
					<div class="layui-inline">
						   <button class="layui-btn" type="button" data-method="doSearchSum">查询</button>
						   <button class="layui-btn" type="button" data-method="doExcel">excel下载</button>
						   
 					</div>
				</div>
				<div class="layui-form-item">
				<div class="layui-inline">
					<div class="layui-inline">
						<input class="layui-input"  id="needName"
							placeholder="需求名称">
					</div>
					<div class="layui-inline">
						<input class="layui-input" id="needNo"
							placeholder="需求编号">
					</div>
					<div class="layui-inline">
						<select name="stage" id="stage" >
 	                    <option value="">选择最新阶段</option>
 	                    <option value="">全部</option>
	               <option value="10">需求酝酿</option>
						<option value="01">需求分析</option>
						<option value="11">需求确认</option>
						<option value="02">需求评审</option>
						<option value="03">技术评审</option>
						<option value="04">开发联调</option>
						<option value="05">SIT测试</option>
						<option value="06">UAT测试</option>
						<option value="07">需求上线</option>
						<option value="08">回顾总结</option>
						</select>
					</div>
				</div>
			</div>
			</div>
			<div class="layui-form-item" id="dateDiv">
				<div class="layui-inline">
					<table class="layui-table" lay-even="" lay-skin="line" style="text-align: center;">
						<colgroup>
							<col width="140">
							<col width="140">
							<col width="140">
							<col width="140">
							<col width="140">
							<col width="140">
							<col width="140">
						</colgroup>
						<thead>
							<tr>
								<th>团队名称</th>
								<th>项目组</th>
  								<th>需求编号</th>
								<th>需求名称</th>
								<th>参与人员</th>
								<th>最新报工日期</th>
								<th>需求评估人月</th>
								<th>成本控制人月</th>
								<th>需求消耗人月</th>
								<th>最新需求阶段</th>
								<th>需求状态</th>
								<th>需求消耗/需求评估</th>
								<th>分析结果</th>
							</tr>
						</thead>
						<tbody id="detailDiv">

						</tbody>
						<script id="tplSrc" type="text/html">
							 {{#  layui.each(d.rsList, function(index, x){}}
							     <tr >
								   <td>{{x.proGroupName==undefined?'':x.proGroupName}}</td>
								   <td>{{x.proTeamName==undefined?'':x.proTeamName}}</td>
								   <td>{{x.needNo==undefined?'':x.needNo}}</td>
								   <td>{{x.needName==undefined?'':x.needName}}</td> 
								   <td>{{x.userName==undefined?'':x.userName}}</td>
								   <td>{{x.endWorkDate==undefined?'':x.endWorkDate}}</td>  
								   <td>{{x.needTime==undefined?'':x.needTime}}</td> 
								   <td>{{x.baseNeedTime==undefined?'':x.baseNeedTime}}</td> 
								   <td>{{x.needUseTime==undefined?'':x.needUseTime}}</td> 
								   <td>{{x.stage==undefined?'':x.now_time<x.new_time?x.stage+ '<font color="red">(逾期</font>'+(x.new_time-x.now_time)+'<font color="red">天)</font>':x.stage}}</td> 
								   <td>{{x.state==undefined?'':x.state}}</td>
								   <td>{{x.ycbl==undefined?'':x.ycbl}}</td> 
								   <td>{{x.ycqk==undefined?'':x.ycqk}}</td> 
 							    </tr>
							{{#  }); }} 
					   </script>
					</table>
				</div>
			</div> 
			<div class="layui-form-item">
				<div class="layui-inline">
					<div id="laypageDiv"></div>
				</div> 
			</div>
		</form>
	</div>
	<input id="bindStat" type="hidden" name="bindStat" value="">
	<input id="zhifuStat" type="hidden" name="zhifuStat" value="">
	<input id="sunRedio" type="hidden" name="sunRedio" value="0">
	<input id="totalNum" type="hidden" name="totalNum" >
</body>
<script type="text/javascript">
var path="<%=commonPath%>";
var msg =new msgTool();
layui.use(
		[ 'form', 'layer', 'laytpl', 'laypage','laydate' ],
		function() {
			var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句
	        var form = layui.form()
	            ,layer = layui.layer
	            ,laypage = layui.laypage
	            ,laytpl = layui.laytpl; 
			  
	        var active = {
	        		
	        		doSearchSum : function() { //搜索
			      	     active.doSearchDetail(1); 
			         }
			         ,doSearchDetail:function(v_curr){ //搜索
			         if(v_curr==1){
			      	    var getTpl = tplSrc.innerHTML;
			  			var dataObj = {
			  						"startRow" : (v_curr-1)*15,
			  						"pageSize" : 15,
			  						"proGroupNo" : $("#proGroupNo").val(),
									"proTeamNo" : $("#proTeamNo").val(),
									"needNo" : $("#needNo").val(),
									"needName" : $("#needName").val(),
									"stage" : $("#stage").val(),
			  					};
			  			msg.sendMsg("/page/main/needPreDiction.do",dataObj,function(data) {
			  				laytpl(getTpl).render(data.body,function(html) {
			  				    detailDiv.innerHTML = html;
			  					$('#totalNum').val(data.body.count)
			  				});
			  				totalNum = Math.ceil(data.body.count/15);
			  				laypage({
				                   cont: 'laypageDiv'
				                 ,pages:totalNum
				                  ,jump: function(obj,first){
				                	  if(first!=true){
				                	  	active.doSearchDetail(obj.curr); 
				                	  }
				                   }
				                 }); 
			  			}); 
			         }else{
			        	    var getTpl = tplSrc.innerHTML;
				  			var dataObj = {
				  						"startRow" : (v_curr-1)*15,
				  						"pageSize" : 15,
				  						"proGroupNo" : $("#proGroupNo").val(),
										"proTeamNo" : $("#proTeamNo").val(),
										"needNo" : $("#needNo").val(),
										"needName" : $("#needName").val(),
										"stage" : $("#stage").val(),
				  					};
				  			msg.sendMsg("/page/main/needPreDiction.do",dataObj,function(data) {
				  				laytpl(getTpl).render(data.body,function(html) {
				  				    detailDiv.innerHTML = html;
				  					$('#totalNum').val(data.body.count)
				  				});
				  			}); 
			         }
			         }, 
				
							
							 doExcel:function() {
								 var dataObj = {
										"proGroupNo" : $("#proGroupNo").val(),
										"proTeamNo" : $("#proTeamNo").val(),
										"needNo" : $("#needNo").val(),
										"needName" : $("#needName").val(),
										"stage" : $("#stage").val(),
	 								} 		 
								 msg.sendMsg("/page/main/doPreDictionExcelFile.do",dataObj,function(data){
					 			 	 	window.location.href = path +"/downFile/"+data.body.fileName
								 	});
							   }

						}
	        $('.layui-btn').on('click', function(){
	            var othis = $(this), method = othis.data('method');
	            active[method] ? active[method].call(this, othis) : '';
	          }); 	 
	  });
</script>
</html>